VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form dlgConsultaProductos 
   BackColor       =   &H80000013&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Consulta de Productos"
   ClientHeight    =   4125
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6030
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4125
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton CancelButton 
      Caption         =   "Cancelar"
      Height          =   375
      Left            =   4680
      TabIndex        =   1
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "Aceptar"
      Height          =   375
      Left            =   4680
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
   Begin MSFlexGridLib.MSFlexGrid lvProductos 
      Height          =   3855
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   4335
      _ExtentX        =   7646
      _ExtentY        =   6800
      _Version        =   393216
      FixedCols       =   0
      Redraw          =   -1  'True
      SelectionMode   =   1
   End
End
Attribute VB_Name = "dlgConsultaProductos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim stringitem As String
Public pro_codigo As Integer


Private Sub CancelButton_Click()
pro_codigo = 0
Unload Me
End Sub

Private Sub Form_Load()
lvProductos.Cols = 2
lvProductos.ColWidth(0) = 700 'columna item
lvProductos.ColWidth(1) = 3500 ' columna prod
lvProductos.TextMatrix(0, 0) = "Codigo"
lvProductos.ColAlignment(0) = flexAlignRightCenter
lvProductos.TextMatrix(0, 1) = "Descripcion"

lvProductos.Rows = 1
ConsultaSql "select pro_codigo, pro_denom FROM producto p  "
If Not rs.RecordCount = 0 Then
rs.MoveFirst
While (Not rs.EOF)
    stringitem = Str(rs!pro_codigo) & Chr(9) & rs!pro_denom
    lvProductos.AddItem stringitem
    
    rs.MoveNext
    
Wend

End If

End Sub



Private Sub lvProductos_DblClick()
pro_codigo = lvProductos.TextMatrix(lvProductos.Row, 0)
Unload Me
End Sub

Private Sub OKButton_Click()
pro_codigo = lvProductos.TextMatrix(lvProductos.Row, 0)
Unload Me
End Sub
